package org.jground.rx.ui.zk.viewControl;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jground.rx.RXView;
import org.jground.rx.ui.zk.UIFrame;
import org.jground.util.ArrayUtils;
import org.zkoss.zul.Label;

public class UIAttributeViewCurrency extends UIAttributeViewBase {

    private static Log logger = LogFactory.getLog(UIAttributeViewCodetable.class);

    public UIAttributeViewCurrency createNew(UIFrame uiFrame, RXView moView) {
        return new UIAttributeViewCurrency(uiFrame, moView);
    }

    public UIAttributeViewCurrency() {}

    private Label valueLabel;

    private UIAttributeViewCurrency(UIFrame uiFrame, RXView moView) {
        super(uiFrame, moView);
        logger.debug("start UIAttributeViewCurrency");
        add(valueLabel = new Label());
    }

    public void set(String... values) {
        clear();
        if (ArrayUtils.isNotEmpty(values) && values.length > 1) {
            String s = values[0] + " " + values[1];
            renderToStringS.add(s);
            valueLabel.setValue(s);
        }
    }

    public void clear() {
        valueLabel.setValue("");
        renderToStringS.clear();
    }
}
